package com.tpcpp.ssm.service.impl;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSON;
import com.tpcpp.ssm.dao.IUserDao;
import com.tpcpp.ssm.pojo.User;
import com.tpcpp.ssm.service.IUserService;
/**
 * 鐢ㄦ埛涓氬姟閫昏緫灞�
 * @author tanp
 *
 */
@Service("userService")
public class UserServiceImpl implements IUserService{
	private static final Logger logger = Logger.getLogger(UserServiceImpl.class);
	
	/**
	 * 寮曠敤鎸佷箙灞傛帴鍙�鎿嶄綔鏁版嵁搴�
	 */
	@Autowired
	private IUserDao userDao;
	
	/**
	 * 鏍规嵁鐢ㄦ埛ID鑾峰彇鐢ㄦ埛淇℃伅
	 */
	public User getUserById(Integer userId) {
		logger.info("锛嶏紞锛嶏紞锛嶏紞锛嶆牴鎹敤鎴凤缉锛よ幏鍙栫敤鎴蜂俊鎭痝etUserById锛嶏紞锛嶏紞锛嶏紞start----");
		User user = userDao.selectByPrimaryKey(userId);
		if(user!=null){
			logger.info("锛嶏紞锛嶏紞锛嶏紞锛嶆牴鎹敤鎴凤缉锛よ幏鍙栫敤鎴蜂俊鎭痝etUserById锛嶏紞锛嶏紞锛嶏紞杩斿洖缁撴灉="+JSON.toJSONString(user));
		}
		logger.info("锛嶏紞锛嶏紞锛嶏紞锛嶆牴鎹敤鎴凤缉锛よ幏鍙栫敤鎴蜂俊鎭痝etUserById锛嶏紞锛嶏紞锛嶏紞end----");
		return user;
	}
	

}
